<template>
    <van-row>
        <van-col :span="24">

            <van-address-edit
                :area-list="areaList"
                show-delete
                show-set-default
                show-search-result
                :area-columns-placeholder="['请选择', '请选择', '请选择']"
                @save="onSave"
                />

        </van-col>
    </van-row>
</template>

<script setup>
import { ref,onMounted, getCurrentInstance } from "vue";
import { areaList } from '@vant/area-data';
import {showNotify} from 'vant';

const {proxy} = getCurrentInstance();

const searchResult = ref([]);

const onSave = (addressEditInfo) => {
    console.log('save---',addressEditInfo);
    // let address = {
    //     contactName: addressEditInfo.name,
    //     contactTel: addressEditInfo.tel,
    //     address: addressEditInfo.province+addressEditInfo.city+addressEditInfo.county+addressEditInfo.addressDetail,
    //     userId: userId.value
    // }

    // proxy.$axios({
    //     method: 'post',
    //     url: '/address/save',
    //     data: address
    // }).then(res=>{
    //     let resultBean = res.data;
    //     if(resultBean.code == 200){
    //         showNotify({message: '添加地址成功'});
    //         proxy.$router.push("/main/address")
    //     }else{
    //         showNotify({message: resultBean.msg});
    //     }
    // }).catch(error=>{
    //     showNotify({message: error.message});
    // })

};

const userId = ref(null);

onMounted(()=>{

    userId.value = 1;


})
</script>

<style>
</style>